package org.marvell.tests;

import org.jsystem.webdriver_so.WebDriverSystemObject;
import org.junit.Before;
import org.junit.Test;
import org.marvell.infra.NikolaLoginPage;
import org.openqa.selenium.WebDriver;

import jsystem.extensions.analyzers.text.FindText;
import jsystem.framework.TestProperties;
import junit.framework.SystemTestCase4;

public class WebGuiOperations extends SystemTestCase4 {
	
	WebDriverSystemObject seleniumSO;
	

	WebDriver driver;
	private String user;
private String password;
	
	@Before
	public void loadSeleniumDriver() throws Exception{
		seleniumSO = (WebDriverSystemObject) system.getSystemObject("driver");
		driver = seleniumSO.getDriver();
	}
	
	@Test
	@TestProperties()
	public void successfulLogin() throws Exception{
		NikolaLoginPage loginPage = new NikolaLoginPage(driver,"2.2.2.5");
		loginPage.successfulLogin(user, password);
	}
	
	@Test
	@TestProperties()
	public void FailedLogin() throws Exception{
		NikolaLoginPage loginPage = new NikolaLoginPage(driver,"2.2.2.5");
		String err = loginPage.failedLogin(user, password );
		analyzer.setTestAgainstObject(err);
		analyzer.analyze(new FindText("Invalid user name or password. Please try again."));
	}
	
	public String getUser() {
		return user;
	}

	public void setUser(String user) {
		this.user = user;
	}

	

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}



}
